<!DOCTYPE html>
<html>
<head>
	<include file="Public:common-css" />
	<link type="text/css" rel="stylesheet" href="__ICSS__/member.css" />
	<link rel="stylesheet" type="text/css" href="__ICSS__/pikaday.css"/>
</head>
<body>
<div class="container">
<!-------------------------header--------------------------------->
<include file="Public:header" />
<!--------------------------content------------------------------->
	<div class="clr"></div>
    <div class="content">
    	<include file="Public:member-left" />
        <div class="member-right">
        	<div class="member-breadcrumbs">
            	<a href="__ROOT__">首页</a>
                &gt;
                <span>个人中心</span>
                &gt;
                <span>订单详情</span>
            </div>
            <div class="o-order-detail">
            	<table width="978" border="0">
            		<thead>
		              <tr height="34">
		                <th><span >订单信息</span></th>
		              </tr>
	             	 </thead>
	             	 <tbody>
	             	 	<tr>
			                <td>
			               	  <table width="100%" border="0">
			                	  <tr>
			                	    <td width="50%">订单编号：<font><{$data.code}></font></td>
			                	    <td width="50%">订单总价：<font>¥<{:formatPrice($data['real_price'] + $data['mail_fee'])}></font>（含运费:￥<{$data.mail_fee}>）</td>
			              	    </tr>
			                	  <tr>
			                	    <td width="50%">下单时间：<font><{$data.create_time|date='Y-m-d H:i:s',###}></font></td>
			                	    <td width="50%">备注：<font><{$data.remark}></font></td>
			              	    </tr>
			           	      </table>
			           	    </td>
			              </tr>
	             	 </tbody>
	            </table>
            </div>
            <div class="o-order-detail">
            	<table width="978" border="0">
            		<thead>
		              <tr height="34">
		                <th><span >收货人信息</span></th>
		              </tr>
	             	 </thead>
	             	 <tbody>
	             	 	<tr>
			                <td>
			               	  <table width="100%" border="0">
			                	  <tr>
			                	    <td width="50%">联系人：<font><{$data.contact_name}></font></td>
			                	    <td width="50%">电话：<font><{$data.contact_tel}></font></td>
			                	    
			              	    </tr>
			                	<tr>
			                	    <td width="50%">地址：<font><{$data.province}><{$data.city}><{$data.area}><{$data.address}></font></td>
			                	    <if condition="$data.mail_type eq 1">
				                	<td width="50%">配送时间：<font><{$data.mail_time}></font></td>
				                	</if>
			              	    </tr>
			           	      </table>
			           	    </td>
			              </tr>
	             	 </tbody>
	            </table>
            </div>
        	<div class="clr"></div>
          	<div class="o-table msyh" style="margin-top:20px;">
           		<table width="978" border="0">
            		<tbody>
		            	<tr>
		           	        <th colspan="2" height="30" align="center" valign="middle">商品信息</th>
		                    <th height="30" align="center" valign="middle">数量</th>
		           	        <th height="30" align="center" valign="middle">单价</th>
		                    <th height="30" align="center" valign="middle">总价</th>
		           	        <th height="30" align="center" valign="middle">交易操作</th>
		           	    </tr>
		           	    <foreach item="dl" name="data.detailsList">
	                	<tr>
		            	    <td height="40" width="9%" align="center">
		            	    	<a href="__ROOT__/Product/details?productId=<{$dl.product_id}>" class="order-photo"><img src="__IMGROOT__<{$dl.photo}>" height="80" width="80"></a>
		            	    </td>
		            	    <td height="40" width="35%" valign="top" align="left">
		                    	<div class="order-info">
		                            <strong><{$dl.name}></strong>
		                        </div>
		                    </td>
		                    <td height="40" width="10%" valign="middle" align="center"><{$dl.num}></td>
		            	    <td height="40" width="14%" valign="middle" align="center">
		           	    		<p class="o-price">￥<{$dl.price}></p>
		                    </td>
		                    <if condition="$key eq 0">
		                    <td rowspan="<{:count($data['detailsList'])}>" class="l-b-table" width="12%" valign="top" align="center">
		                    	<font class="order-price">￥<{:formatPrice($data['real_price'] + $data['mail_fee'])}></font>
		                    	<p>含运费:￥<{$data.mail_fee}></p>
		                    </td>
		            	    <td rowspan="<{:count($data['detailsList'])}>" class="l-b-table" width="10%" valign="top" align="center">
		            	    	<switch name="data.status">
		            	    		<case value="1">
		            	    			<a class="order-config-btn" href="__ROOT__/Order/payment?orderCode=<{$data.code}>">去付款</a>
		            	    			<a class="" href="javascript:void(0)" ref="<{$data.code}>" onclick="cancelOrder(this)">取消订单</a>
		            	    		</case>
		            	    		<case value="2">
		            	    			<a class="" href="javascript:void(0)" ref="<{$data.code}>" onclick="applyReturnOrder(this)">申请退款</a>
		            	    		</case>
		            	    		<case value="3">
		            	    			<a class="order-config-btn" href="javascript:void(0)" ref="<{$data.code}>" onclick="doneOrder(this)">确定收货</a>
		            	    			<a class="" href="javascript:void(0)" ref="<{$data.code}>" onclick="applyReturnOrder(this)">申请退款</a>
		            	    		</case>
		            	    		<case value="4">完成</case>
		            	    		<case value="0">退款处理中</case>
		            	    		<case value="-1">失效</case>
		            	    		<case value="-2">退款完成</case>
		            	    		<case value="-3">
		            	    			<a class="order-config-btn" href="javascript:void(0)" ref="<{$data.code}>" onclick="doneOrder(this)">确定收货</a>
									</case>
		            	    	</switch>    	    	
		            	    </td>
		            	    </if>
	                    </tr>
                    	</foreach>
                    </tbody>
            	</table>
            </div>
            <div class="clr"></div>
            <!-- 订单列表结束 -->
        </div>
    </div>
    <div class="clr"></div>
<!--------------------------content-end--------------------------->
    <include file="Public:footer" />
</div>

</body>
<include file="Public:common-js" />
<script type="text/javascript">
	//取消订单
	function cancelOrder(t){
		$.ajax({
			url:"__ROOT__/Order/cancelOrder",
			type:"post",
			data:{'orderCode':$(t).attr("ref")},
			success:function(data){
				var data = eval("("+data+")");
				if(data.status == 1){
					layer.msg(data.info);
					window.location.reload();
				}else{
					layer.msg(data.info);
				}
			}
		})
	}
	
	//确认订单
	function doneOrder(t){
		$.ajax({
			url:"__ROOT__/Order/doneOrder",
			type:"post",
			data:{'orderCode':$(t).attr("ref")},
			success:function(data){
				var data = eval("("+data+")");
				if(data.status == 1){
					layer.msg(data.info);
					window.location.reload();
				}else{
					layer.msg(data.info);
				}
			}
		})
	}
	//申请退款
	function applyReturnOrder(t){
		layerDialog("申请退款",'__ROOT__/Order/refund?orderCode='+$(t).attr("ref"),"720px","620px",true);
	}
</script>
</html>
